package com.taobao.analyse.map;

import java.io.IOException;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.io.Writable;
import org.apache.hadoop.mapred.MapReduceBase;
import org.apache.hadoop.mapred.Mapper;
import org.apache.hadoop.mapred.OutputCollector;
import org.apache.hadoop.mapred.Reporter;

import com.taobao.analyse.constants.SplitConstants;

public class MergeTimeResultTempMapper extends MapReduceBase implements
		Mapper<Writable, Text, Text, LongWritable> {

	@Override
	public void map(Writable key, Text value,
			OutputCollector<Text, LongWritable> output, Reporter reporter)
			throws IOException {
		String line = value.toString();

		String[] datas = line.split(SplitConstants.SPLIT_OUTPUT);

		if (datas.length < 2) {
			return;
		}

		output.collect(new Text(datas[0]),
				new LongWritable(Long.parseLong(datas[1])));
	}

}
